<?php

namespace App\Http\Controllers\WorkOrder\Merchant;

use App\Http\Controllers\BaseController;
use App\Http\Validate\WorkOrder\WorkOrderValidate;
use App\Service\WorkOrder\WorkOrderService;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;

class WorkOrderController extends BaseController
{
    /**
     * @param Request $request
     * @param string $workOrderNo
     * @return JsonResponse
     * @throws ValidationException
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function merchantConfirmFinish(Request $request, string $workOrderNo): JsonResponse
    {
        $params = WorkOrderValidate::merchantConfirmFinishValidate(
            $request->merge(["workOrderNo" => $workOrderNo])->all()
        );
        WorkOrderService::merchantConfirmFinish($params);
        return $this->success();
    }
}
